<?php 

/**
 * Custom Adapter for Doctrine to use with Zend_Paginator
 *
 * @author Josh Team - http://joshteam.wordpress.com
 * @version 1
 */

class Custom_Paginator_Adapter_Doctrine implements Zend_Paginator_Adapter_Interface{
	
	protected $_select;
	
    public function __construct( Doctrine_Query $select )
    {
    	$this->_select = $select;        
    }
    
    public function getItems($offset, $itemCountPerPage)
    {
        return $this->_select->offset($offset)->limit($itemCountPerPage)->execute();
    }
    
    public function count()
    {
        return $this->_select->count();
    }
}